package com.example.demo.api;

import java.util.List;
import java.util.Map;

/**
 * Created by Hy on 2018/8/6.
 */
public interface IEmailMicroService {
    public static enum EMAIL_TYPE{
        FORGOTPWD(1,"忘记密码,发送验证码"),REGISTER(2,"注册发送验证码"),
        HTML(3,"发送HTML格式"),VOICESENDMSG(3,"CRM 工单分派时发送邮件");
        public int status;
        public String content;

        private EMAIL_TYPE(int status, String content) {
            this.status = status;
            this.content = content;
        }
        public static EMAIL_TYPE get(int key){
            EMAIL_TYPE[] values = EMAIL_TYPE.values();
            for (EMAIL_TYPE obj:values
                 ) {
                if(obj.status==key){
                    return obj;
                }
            }
            return null;
        }
    }

    /**
     * 发送文本邮件
     * @param emailAddr 地址
     * @param title 标题
     * @param content 文本内容
     * @param type 邮件类型
     */
    public void sendMsgEmail(String emailAddr,String title,String content,EMAIL_TYPE type);

    /**
     * 发送附件邮件
     * @param emailAddr 地址
     * @param title 标题
     * @param content 文本内容
     * @param attachments 附件
     *                    {attachPath:url 附件地址目前只支持url
     *                    attachName:attachName, 附件名称
     *                    attachDesc:attachDesc 附件描述
     * }
     * @param type 邮件类型
     */
    public void sendAttachmentToEmail(String emailAddr, String title, String content, List<Map<String,String>> attachments,EMAIL_TYPE type);

    /**
     * 发送邮件
     * @param paramMap
     * @param type 邮件类型
     */
    public void sendMsgToEmail(Map<String,String> paramMap,EMAIL_TYPE type);
}
